package org.forwhat.filter;

import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpFilter;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

/**
 * @projectName: ForWhat
 * @package: org.forwhat.filter
 * @className: OptionsFilter
 * @author: LGJ
 * @description: TODO
 * @date: 2023/11/29 17:47
 * @version: 1.0
 */
public class OptionsFilter extends HttpFilter {
    @Override
    protected void doFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {
        if (request.getMethod().equalsIgnoreCase("OPTIONS")) {
            response.setStatus(200);
            return;
        }
        chain.doFilter(request,response);
    }
}
